<template>
	<!-- 发布页面 -->
  <view class="releasePage">
    <view class="content">
    	<view class="uni-padding-wrap uni-common-mt">
    		<uni-segmented-control :current="current" :values="items" :style-type="styleType"
    		:active-color="activeColor" @clickItem="onClickItem" />
    	</view>
		<view class="content-form">
			<view v-if="current === 0">
				<publishform :publishstyle="current"></publishform>
			</view>
			<view v-if="current === 1">
				<publishform2 :publishstyle="current"></publishform2>
			</view>
			<view v-if="current === 4"><text class="content-text">选项卡3的内容</text></view>
		</view>
    </view>
  </view>
</template>

<script>
  import {mapState,mapActions,mapMutations} from 'vuex'
  export default {
    data() {
      return {
        current: 0,
		items: ['发布房源', '发布租房', '发布旧物'],
		styleType: 'button',
		activeColor: '#2bbbef',
      };
    },
    computed: {
      ...mapState('m_user',['token'])
    },
	methods:{
    ...mapActions('m_nav',['delayNavigate']),
    ...mapMutations('m_path',['setPath']),
		onClickItem(e) {
			if (this.current !== e.currentIndex) {
				this.current = e.currentIndex
				}
			},
	},
  onLoad() {
    if(!this.token) {
      this.delayNavigate()
      this.setPath({
      type:'switchTab',
      url:'/pages/publish/publish'
      
    })
      
    }
    
  },
  }
</script>

<style lang="scss" scoped>
	.releasePage{
		background-color: #ffffff;
		width: 100%;
		height: 100%;
		padding: 1% 1% 0 1%;
		.content{
			width: 98%;
			.content-form{
				width: 100%;
				/deep/.uni-forms-item--border .uni-forms-item__content {
					display: flex;
					justify-content: center !important;
				}
			}
		}
	}

</style>
